package com.finalcial.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.finalcial.dao.UserDao;
import com.finalcial.po.LoginMsg;
import com.finalcial.po.UserPersonalMsg;
import com.finalcial.service.UserService;

@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserDao userDao;
	
	@Override
	public List<Map<String, Object>> getUserMsg(String userName, String password) {
		List<Map<String, Object>> list = userDao.getUserMsg(userName, password);
		return list;
	}
	@Override
	public List<Map<String, Object>> listgetEmployeeInformationByOrdinary(Integer userId) {
		return null;
	}
	@Override
	public List<Map<String, Object>> listEmployeeInformation(Integer startPos, Integer pageSize) {
		List<Map<String, Object>> list = userDao.listEmployeeInformation(startPos, pageSize);
		return list;
	}
	@Override
	public UserPersonalMsg getEmployeeInformationByOrdinary(Integer userId) {
		return userDao.getEmployeeInformationByOrdinary(userId);
	}
	@Override
	public Integer getUserCounts() {
		return userDao.getUserCounts();
	}
	@Override
	public Integer deleteEmployeeInformation(Integer userId) {
		return userDao.deleteEmployeeInformation(userId);
	}
	@Override
	public Integer updateEmployeeInformation(Integer userId, Integer departmentId, Integer userTypeId,
			Integer companyId, String phone, String bankNumber, String bankName, String password) {
		return userDao.updateEmployeeInformation(userId, departmentId, userTypeId, companyId, phone, bankNumber, bankName, password);
	}
	@Override
	public Integer insertEmployeeInformation(String userName, Integer departmentId, Integer userTypeId,
			Integer companyId, String phone, String bankNumber, String bankName, String password) {
		return userDao.insertEmployeeInformation(userName, departmentId, userTypeId, companyId, phone, bankNumber, bankName, password);
	}
	@Override
	public List<Map<String, Object>> getEmployeeInformation(Integer userId, String userName, String departmentName, String userTypeName,
			String companyName) {
		return userDao.getEmployeeInformation(userId, userName, departmentName, userTypeName, companyName);
	}
	@Override
	public Integer updateUserInfoOne(Integer userId, String password) {
		return userDao.updateUserInfoOne(userId, password);
	}
	@Override
	public LoginMsg getLoginMsg(String userName, String password) {
		return userDao.getLoginMsg(userName, password);
	}
	@Override
	public List<Map<String, Object>> getFunctionByUserId(String userId, String parent) {
		List<Map<String, Object>> functions = null;
		if("".equals(userId)==false && "".equals(parent)==false) {
			functions = userDao.getFunctionByUserId(Integer.parseInt(userId), Integer.parseInt(parent));
		}
		return functions;
	}

}
